<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>UC-INT-003：外部服务集成原型</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd@5.12.8/dist/reset.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }
        
        .header {
            background: #fff;
            padding: 16px 24px;
            border-bottom: 1px solid #e8e8e8;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        
        .breadcrumb {
            color: #666;
            font-size: 14px;
        }
        
        .breadcrumb a {
            color: #1890ff;
            text-decoration: none;
        }
        
        .main-content {
            padding: 24px;
            max-width: 1400px;
            margin: 0 auto;
        }
        
        .content-area {
            display: grid;
            grid-template-columns: 1fr 400px;
            gap: 24px;
        }
        
        .main-panel {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        
        .panel-header {
            background: #fafafa;
            padding: 16px 20px;
            border-bottom: 1px solid #e8e8e8;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .panel-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        
        .panel-actions {
            display: flex;
            gap: 12px;
        }
        
        .btn {
            padding: 8px 16px;
            border: 1px solid;
            border-radius: 6px;
            font-size: 13px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.3s;
        }
        
        .btn-primary {
            background: #1890ff;
            border-color: #1890ff;
            color: #fff;
        }
        
        .btn-primary:hover {
            background: #40a9ff;
            border-color: #40a9ff;
        }
        
        .btn-success {
            background: #52c41a;
            border-color: #52c41a;
            color: #fff;
        }
        
        .btn-success:hover {
            background: #73d13d;
            border-color: #73d13d;
        }
        
        .btn-warning {
            background: #faad14;
            border-color: #faad14;
            color: #fff;
        }
        
        .btn-warning:hover {
            background: #ffc53d;
            border-color: #ffc53d;
        }
        
        .btn-danger {
            background: #ff4d4f;
            border-color: #ff4d4f;
            color: #fff;
        }
        
        .btn-danger:hover {
            background: #ff7875;
            border-color: #ff7875;
        }
        
        .btn-default {
            background: #fff;
            border-color: #d9d9d9;
            color: #333;
        }
        
        .btn-default:hover {
            border-color: #1890ff;
            color: #1890ff;
        }
        
        .panel-content {
            padding: 20px;
        }
        
        .service-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
            margin-bottom: 24px;
        }
        
        .service-card {
            border: 1px solid #e8e8e8;
            border-radius: 8px;
            padding: 20px;
            transition: all 0.3s;
            cursor: pointer;
        }
        
        .service-card:hover {
            border-color: #1890ff;
            box-shadow: 0 4px 12px rgba(24, 144, 255, 0.1);
        }
        
        .service-card.connected {
            border-color: #52c41a;
            background: #f6ffed;
        }
        
        .service-card.error {
            border-color: #ff4d4f;
            background: #fff2f0;
        }
        
        .service-card.disabled {
            border-color: #d9d9d9;
            background: #fafafa;
            opacity: 0.6;
        }
        
        .service-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
        }
        
        .service-name {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        
        .service-status {
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 500;
        }
        
        .status-connected {
            background: #f6ffed;
            color: #52c41a;
            border: 1px solid #b7eb8f;
        }
        
        .status-disconnected {
            background: #fff2f0;
            color: #ff4d4f;
            border: 1px solid #ffccc7;
        }
        
        .status-connecting {
            background: #e6f7ff;
            color: #1890ff;
            border: 1px solid #b3d8ff;
        }
        
        .status-disabled {
            background: #f5f5f5;
            color: #999;
            border: 1px solid #d9d9d9;
        }
        
        .service-description {
            font-size: 13px;
            color: #666;
            margin-bottom: 12px;
            line-height: 1.5;
        }
        
        .service-actions {
            display: flex;
            gap: 8px;
        }
        
        .service-info {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-top: 12px;
            font-size: 11px;
            color: #666;
        }
        
        .info-item {
            display: flex;
            justify-content: space-between;
        }
        
        .info-label {
            font-weight: 500;
        }
        
        .info-value {
            color: #333;
        }
        
        .integration-log {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 16px;
            margin-bottom: 20px;
        }
        
        .log-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
        }
        
        .log-title {
            font-size: 14px;
            font-weight: 600;
            color: #333;
        }
        
        .log-actions {
            display: flex;
            gap: 8px;
        }
        
        .log-content {
            background: #fff;
            border: 1px solid #e8e8e8;
            border-radius: 6px;
            padding: 12px;
            max-height: 200px;
            overflow-y: auto;
            font-family: 'Courier New', monospace;
            font-size: 12px;
            line-height: 1.4;
        }
        
        .log-entry {
            margin-bottom: 4px;
            padding: 2px 0;
        }
        
        .log-entry.info {
            color: #1890ff;
        }
        
        .log-entry.success {
            color: #52c41a;
        }
        
        .log-entry.warning {
            color: #faad14;
        }
        
        .log-entry.error {
            color: #ff4d4f;
        }
        
        .log-timestamp {
            color: #999;
            margin-right: 8px;
        }
        
        .config-section {
            margin-bottom: 24px;
        }
        
        .config-title {
            font-size: 14px;
            font-weight: 600;
            color: #333;
            margin-bottom: 12px;
        }
        
        .config-form {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 16px;
        }
        
        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
            margin-bottom: 16px;
        }
        
        .form-item {
            margin-bottom: 16px;
        }
        
        .form-label {
            display: block;
            font-size: 13px;
            color: #333;
            margin-bottom: 6px;
            font-weight: 500;
        }
        
        .form-control {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #d9d9d9;
            border-radius: 6px;
            font-size: 13px;
        }
        
        .form-control:focus {
            outline: none;
            border-color: #1890ff;
            box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
        }
        
        .form-control textarea {
            min-height: 80px;
            resize: vertical;
        }
        
        .checkbox-item {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
        }
        
        .checkbox-item input[type="checkbox"] {
            margin: 0;
        }
        
        .sidebar {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        
        .sidebar-panel {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        
        .sidebar-header {
            background: #fafafa;
            padding: 16px 20px;
            border-bottom: 1px solid #e8e8e8;
        }
        
        .sidebar-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        
        .sidebar-content {
            padding: 20px;
        }
        
        .service-list {
            list-style: none;
        }
        
        .service-list-item {
            padding: 12px;
            border: 1px solid #f0f0f0;
            border-radius: 6px;
            margin-bottom: 8px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .service-list-item:hover {
            border-color: #1890ff;
            background: #f0f8ff;
        }
        
        .service-list-item.selected {
            border-color: #1890ff;
            background: #e6f7ff;
        }
        
        .service-list-item-title {
            font-size: 13px;
            font-weight: 500;
            color: #333;
            margin-bottom: 4px;
        }
        
        .service-list-item-meta {
            font-size: 11px;
            color: #666;
            display: flex;
            justify-content: space-between;
        }
        
        .stats-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }
        
        .stat-item {
            text-align: center;
            padding: 12px;
            background: #f8f9fa;
            border-radius: 6px;
        }
        
        .stat-value {
            font-size: 18px;
            font-weight: 600;
            color: #1890ff;
            margin-bottom: 4px;
        }
        
        .stat-label {
            font-size: 11px;
            color: #666;
        }
        
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        
        .modal-content {
            background: #fff;
            border-radius: 8px;
            padding: 24px;
            max-width: 600px;
            width: 90%;
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .modal-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
        }
        
        .modal-close {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #999;
        }
        
        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            margin-top: 20px;
        }
        
        @media (max-width: 768px) {
            .content-area {
                grid-template-columns: 1fr;
            }
            
            .sidebar {
                order: -1;
            }
            
            .form-row {
                grid-template-columns: 1fr;
            }
            
            .service-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <!-- 页面头部 -->
    <div class="header">
        <div class="breadcrumb">
            <a href="#">首页</a> > <a href="#">系统管理</a> > 外部服务集成
        </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
        <div class="content-area">
            <!-- 主面板 -->
            <div class="main-panel">
                <div class="panel-header">
                    <div class="panel-title">外部服务集成</div>
                    <div class="panel-actions">
                        <button class="btn btn-default" onclick="refreshServices()">🔄 刷新</button>
                        <button class="btn btn-primary" onclick="addService()">➕ 添加服务</button>
                    </div>
                </div>
                
                <div class="panel-content">
                    <!-- 服务网格 -->
                    <div class="service-grid">
                        <!-- MES系统 -->
                        <div class="service-card connected" onclick="selectService('mes')">
                            <div class="service-header">
                                <div class="service-name">MES系统</div>
                                <div class="service-status status-connected">已连接</div>
                            </div>
                            <div class="service-description">
                                制造执行系统，用于生产数据同步和工单管理
                            </div>
                            <div class="service-actions">
                                <button class="btn btn-success" onclick="testConnection('mes')">🔍 测试</button>
                                <button class="btn btn-warning" onclick="editService('mes')">⚙️ 配置</button>
                                <button class="btn btn-danger" onclick="disconnectService('mes')">❌ 断开</button>
                            </div>
                            <div class="service-info">
                                <div class="info-item">
                                    <span class="info-label">连接时间:</span>
                                    <span class="info-value">2024-05-15 09:30</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">最后同步:</span>
                                    <span class="info-value">2分钟前</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">数据量:</span>
                                    <span class="info-value">1,234条</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">状态:</span>
                                    <span class="info-value">正常</span>
                                </div>
                            </div>
                        </div>

                        <!-- ERP系统 -->
                        <div class="service-card connected" onclick="selectService('erp')">
                            <div class="service-header">
                                <div class="service-name">ERP系统</div>
                                <div class="service-status status-connected">已连接</div>
                            </div>
                            <div class="service-description">
                                企业资源规划系统，用于人员信息和培训记录同步
                            </div>
                            <div class="service-actions">
                                <button class="btn btn-success" onclick="testConnection('erp')">🔍 测试</button>
                                <button class="btn btn-warning" onclick="editService('erp')">⚙️ 配置</button>
                                <button class="btn btn-danger" onclick="disconnectService('erp')">❌ 断开</button>
                            </div>
                            <div class="service-info">
                                <div class="info-item">
                                    <span class="info-label">连接时间:</span>
                                    <span class="info-value">2024-05-15 09:25</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">最后同步:</span>
                                    <span class="info-value">5分钟前</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">数据量:</span>
                                    <span class="info-value">856条</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">状态:</span>
                                    <span class="info-value">正常</span>
                                </div>
                            </div>
                        </div>

                        <!-- 考勤系统 -->
                        <div class="service-card error" onclick="selectService('attendance')">
                            <div class="service-header">
                                <div class="service-name">考勤系统</div>
                                <div class="service-status status-disconnected">连接失败</div>
                            </div>
                            <div class="service-description">
                                员工考勤系统，用于培训出勤记录同步
                            </div>
                            <div class="service-actions">
                                <button class="btn btn-success" onclick="testConnection('attendance')">🔍 测试</button>
                                <button class="btn btn-warning" onclick="editService('attendance')">⚙️ 配置</button>
                                <button class="btn btn-primary" onclick="connectService('attendance')">🔗 连接</button>
                            </div>
                            <div class="service-info">
                                <div class="info-item">
                                    <span class="info-label">连接时间:</span>
                                    <span class="info-value">-</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">最后同步:</span>
                                    <span class="info-value">-</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">数据量:</span>
                                    <span class="info-value">0条</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">状态:</span>
                                    <span class="info-value">错误</span>
                                </div>
                            </div>
                        </div>

                        <!-- 质量管理系统 -->
                        <div class="service-card disabled" onclick="selectService('quality')">
                            <div class="service-header">
                                <div class="service-name">质量管理系统</div>
                                <div class="service-status status-disabled">已禁用</div>
                            </div>
                            <div class="service-description">
                                质量管理系统，用于质量标准和检验结果同步
                            </div>
                            <div class="service-actions">
                                <button class="btn btn-default" onclick="enableService('quality')">✅ 启用</button>
                                <button class="btn btn-warning" onclick="editService('quality')">⚙️ 配置</button>
                            </div>
                            <div class="service-info">
                                <div class="info-item">
                                    <span class="info-label">连接时间:</span>
                                    <span class="info-value">-</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">最后同步:</span>
                                    <span class="info-value">-</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">数据量:</span>
                                    <span class="info-value">0条</span>
                                </div>
                                <div class="info-item">
                                    <span class="info-label">状态:</span>
                                    <span class="info-value">禁用</span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 集成日志 -->
                    <div class="integration-log">
                        <div class="log-header">
                            <div class="log-title">集成日志</div>
                            <div class="log-actions">
                                <button class="btn btn-default" onclick="clearLog()">🗑️ 清空</button>
                                <button class="btn btn-default" onclick="exportLog()">📤 导出</button>
                            </div>
                        </div>
                        <div class="log-content">
                            <div class="log-entry success">
                                <span class="log-timestamp">14:32:15</span>
                                [MES] 数据同步成功，同步了 15 条工单记录
                            </div>
                            <div class="log-entry info">
                                <span class="log-timestamp">14:30:22</span>
                                [ERP] 开始同步人员信息...
                            </div>
                            <div class="log-entry success">
                                <span class="log-timestamp">14:30:25</span>
                                [ERP] 人员信息同步完成，更新了 8 条记录
                            </div>
                            <div class="log-entry warning">
                                <span class="log-timestamp">14:28:10</span>
                                [考勤系统] 连接超时，正在重试...
                            </div>
                            <div class="log-entry error">
                                <span class="log-timestamp">14:28:15</span>
                                [考勤系统] 连接失败：网络不可达
                            </div>
                            <div class="log-entry info">
                                <span class="log-timestamp">14:25:00</span>
                                [系统] 开始执行定时同步任务
                            </div>
                        </div>
                    </div>

                    <!-- 服务配置 -->
                    <div class="config-section">
                        <div class="config-title">服务配置</div>
                        <div class="config-form">
                            <div class="form-row">
                                <div class="form-item">
                                    <label class="form-label">服务名称</label>
                                    <input type="text" class="form-control" value="MES系统" readonly>
                                </div>
                                <div class="form-item">
                                    <label class="form-label">服务类型</label>
                                    <input type="text" class="form-control" value="REST API" readonly>
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-item">
                                    <label class="form-label">服务地址</label>
                                    <input type="text" class="form-control" value="https://mes.company.com/api">
                                </div>
                                <div class="form-item">
                                    <label class="form-label">端口</label>
                                    <input type="text" class="form-control" value="443">
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-item">
                                    <label class="form-label">认证方式</label>
                                    <input type="text" class="form-control" value="OAuth 2.0">
                                </div>
                                <div class="form-item">
                                    <label class="form-label">同步频率</label>
                                    <input type="text" class="form-control" value="每5分钟">
                                </div>
                            </div>
                            <div class="form-item">
                                <label class="form-label">同步字段</label>
                                <div class="checkbox-item">
                                    <input type="checkbox" id="field1" checked>
                                    <label for="field1">工单号</label>
                                </div>
                                <div class="checkbox-item">
                                    <input type="checkbox" id="field2" checked>
                                    <label for="field2">产品信息</label>
                                </div>
                                <div class="checkbox-item">
                                    <input type="checkbox" id="field3" checked>
                                    <label for="field3">生产状态</label>
                                </div>
                                <div class="checkbox-item">
                                    <input type="checkbox" id="field4">
                                    <label for="field4">质量数据</label>
                                </div>
                            </div>
                            <div class="form-item">
                                <label class="form-label">备注</label>
                                <textarea class="form-control" placeholder="请输入备注信息...">MES系统集成配置，用于生产数据同步</textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 侧边栏 -->
            <div class="sidebar">
                <!-- 服务列表 -->
                <div class="sidebar-panel">
                    <div class="sidebar-header">
                        <div class="sidebar-title">服务列表</div>
                    </div>
                    <div class="sidebar-content">
                        <ul class="service-list">
                            <li class="service-list-item selected" onclick="selectServiceItem(this)">
                                <div class="service-list-item-title">MES系统</div>
                                <div class="service-list-item-meta">
                                    <span>已连接</span>
                                    <span>2分钟前</span>
                                </div>
                            </li>
                            <li class="service-list-item" onclick="selectServiceItem(this)">
                                <div class="service-list-item-title">ERP系统</div>
                                <div class="service-list-item-meta">
                                    <span>已连接</span>
                                    <span>5分钟前</span>
                                </div>
                            </li>
                            <li class="service-list-item" onclick="selectServiceItem(this)">
                                <div class="service-list-item-title">考勤系统</div>
                                <div class="service-list-item-meta">
                                    <span>连接失败</span>
                                    <span>15分钟前</span>
                                </div>
                            </li>
                            <li class="service-list-item" onclick="selectServiceItem(this)">
                                <div class="service-list-item-title">质量管理系统</div>
                                <div class="service-list-item-meta">
                                    <span>已禁用</span>
                                    <span>-</span>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>

                <!-- 集成统计 -->
                <div class="sidebar-panel">
                    <div class="sidebar-header">
                        <div class="sidebar-title">集成统计</div>
                    </div>
                    <div class="sidebar-content">
                        <div class="stats-grid">
                            <div class="stat-item">
                                <div class="stat-value">4</div>
                                <div class="stat-label">总服务数</div>
                            </div>
                            <div class="stat-item">
                                <div class="stat-value">2</div>
                                <div class="stat-label">已连接</div>
                            </div>
                            <div class="stat-item">
                                <div class="stat-value">1</div>
                                <div class="stat-label">连接失败</div>
                            </div>
                            <div class="stat-item">
                                <div class="stat-value">1</div>
                                <div class="stat-label">已禁用</div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 快速操作 -->
                <div class="sidebar-panel">
                    <div class="sidebar-header">
                        <div class="sidebar-title">快速操作</div>
                    </div>
                    <div class="sidebar-content">
                        <div style="display: flex; flex-direction: column; gap: 8px;">
                            <button class="btn btn-primary" onclick="syncAll()">🔄 同步所有服务</button>
                            <button class="btn btn-warning" onclick="testAll()">🔍 测试所有连接</button>
                            <button class="btn btn-success" onclick="viewLogs()">📋 查看详细日志</button>
                            <button class="btn btn-default" onclick="exportConfig()">📤 导出配置</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 添加服务弹窗 -->
    <div class="modal" id="addServiceModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">添加外部服务</h3>
                <button class="modal-close" onclick="closeModal()">&times;</button>
            </div>
            <div class="modal-body">
                <div class="form-item">
                    <label class="form-label">服务名称</label>
                    <input type="text" class="form-control" placeholder="请输入服务名称">
                </div>
                <div class="form-item">
                    <label class="form-label">服务类型</label>
                    <select class="form-control">
                        <option>REST API</option>
                        <option>SOAP</option>
                        <option>数据库</option>
                        <option>文件系统</option>
                    </select>
                </div>
                <div class="form-item">
                    <label class="form-label">服务地址</label>
                    <input type="text" class="form-control" placeholder="请输入服务地址">
                </div>
                <div class="form-item">
                    <label class="form-label">认证方式</label>
                    <select class="form-control">
                        <option>无认证</option>
                        <option>Basic Auth</option>
                        <option>OAuth 2.0</option>
                        <option>API Key</option>
                    </select>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" onclick="closeModal()">取消</button>
                <button class="btn btn-primary" onclick="confirmAddService()">添加</button>
            </div>
        </div>
    </div>

    <script>
        // 全局变量
        let selectedService = 'mes';

        // 服务操作
        function selectService(serviceId) {
            selectedService = serviceId;
            console.log('选择服务:', serviceId);
        }

        function selectServiceItem(element) {
            document.querySelectorAll('.service-list-item').forEach(item => {
                item.classList.remove('selected');
            });
            element.classList.add('selected');
            
            const title = element.querySelector('.service-list-item-title').textContent;
            console.log('选择服务项:', title);
        }

        function testConnection(serviceId) {
            console.log('测试连接:', serviceId);
            // 模拟测试连接
            setTimeout(() => {
                alert('连接测试成功！');
            }, 1000);
        }

        function editService(serviceId) {
            console.log('编辑服务:', serviceId);
        }

        function connectService(serviceId) {
            console.log('连接服务:', serviceId);
        }

        function disconnectService(serviceId) {
            if (confirm('确定要断开此服务的连接吗？')) {
                console.log('断开服务:', serviceId);
            }
        }

        function enableService(serviceId) {
            console.log('启用服务:', serviceId);
        }

        function addService() {
            document.getElementById('addServiceModal').style.display = 'flex';
        }

        function confirmAddService() {
            closeModal();
            console.log('确认添加服务');
        }

        function refreshServices() {
            console.log('刷新服务');
        }

        function syncAll() {
            console.log('同步所有服务');
        }

        function testAll() {
            console.log('测试所有连接');
        }

        function viewLogs() {
            console.log('查看详细日志');
        }

        function exportConfig() {
            console.log('导出配置');
        }

        function clearLog() {
            if (confirm('确定要清空日志吗？')) {
                console.log('清空日志');
            }
        }

        function exportLog() {
            console.log('导出日志');
        }

        // 弹窗控制
        function closeModal() {
            document.getElementById('addServiceModal').style.display = 'none';
        }

        // 点击弹窗外部关闭
        document.getElementById('addServiceModal').addEventListener('click', (e) => {
            if (e.target.id === 'addServiceModal') {
                closeModal();
            }
        });

        // 初始化
        document.addEventListener('DOMContentLoaded', () => {
            console.log('外部服务集成页面初始化');
        });
    </script>
</body>
</html>

